import Mock from 'mockjs'

export default {
  'post /api/login' (req, res) {
    const loginData = Mock.mock({
      'name':'@cname',
        'nickName': '@last',
        'age|18-28': 0,
        'isMale|1': true,  // 布尔值
        avatar () {
          return Mock.Random.image('100x100', Mock.Random.color(), '#757575', 'png', this.nickName.substr(0, 1))
        }
    })
    res.status(200).json(loginData)
  },
  'put /api/loginPut' (req, res) {
    const loginPutData = Mock.mock({
      'data': {
        'name':'@cname',
        'nickName': '@last',
        'age|18-28': 0,
        'isMale|1': true,  // 布尔值
        avatar () {
          return Mock.Random.image('100x100', Mock.Random.color(), '#757575', 'png', this.nickName.substr(0, 1))
        }
      }
    }).data
    res.status(200).json(loginPutData)
  },
  'delete /api/loginDel' (req, res) {
    const loginDelData = Mock.mock({
      'isMale|1': false
    })
    res.status(200).json(loginDelData)
  }
}